package study;

import java.math.BigDecimal;

/**
 * @Author 刘伟涛
 * @Date 2023/8/9 9:38
 **/
public class BigDecimalDemo {
    public static void main(String[] args) {
        String count = "54.000";
        BigDecimal bigDecimal = new BigDecimal("54.001");
        BigDecimal bigDecimal4 = bigDecimal.stripTrailingZeros();
        System.out.println(bigDecimal4);
        BigDecimal bigDecimal1 = bigDecimal.setScale(0);
        BigDecimal bigDecimal2 = bigDecimal1.stripTrailingZeros();
        BigDecimal bigDecimal3 = bigDecimal2.setScale(3);
        System.out.println(bigDecimal1);
        System.out.println(bigDecimal1.scale());
        System.out.println(bigDecimal2.scale());
        System.out.println(bigDecimal3);
    }
}
